﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

void rev(char* arr)
{
	int len = strlen(arr);
	printf("2.字符串arr的长度：%d\n", len);//11

	//3.字符串arr的首地址arr[0] h;
	char* pStart = arr;
	//4.字符串arr最后一个有效字符的地址arr[10] d;
	char* pEnd = &arr[len - 1];
	while (pStart < pEnd)
	{
		char temp = *pStart;
		*pStart = *pEnd;
		*pEnd = temp;
		pStart++;
		pEnd--;
	}
}

//main80：指针实现字符串反转
int main80()
{
	char arr[] = "hello world";//dlrow olleh
	rev(arr);
	printf("1.输出字符串arr的值：%s\n", arr);//dlrow olleh

	system("pause");
	return EXIT_SUCCESS;
}